package com.weixin.controller;

import com.jfinal.weixin.sdk.api.ApiConfig;
import com.jfinal.weixin.sdk.api.ApiResult;
import com.jfinal.weixin.sdk.api.UserApi;
import com.jfinal.weixin.sdk.jfinal.ApiController;
import com.weixin.util.WeixinUtil;

public class WeixinApiController extends ApiController {
    public ApiConfig getApiConfig() {
        return WeixinUtil.getApiConfig();
    }
    /**
     * 获取公众号关注用户
     */
    public void getFollowers() {
        ApiResult apiResult = UserApi.getFollows();
        renderText(apiResult.getJson());
    }
    /**
     * 获取用户信息
     */
    public void getUserInfo() {
        String openId = getPara();
        ApiResult apiResult = UserApi.getUserInfo(openId);
        renderText(apiResult.getJson());
    }
}